package com.threeonemeeting;

import android.app.Application;

import com.snda.lib.SNBaseLib;
import com.threeonemeeting.model.DownloadInfo;
import com.threeonemeeting.model.DownloadInfoList;

public class MeetingApplication extends Application {

	private DataCenter dataCenter = null;

	public MeetingApplication() {
		dataCenter = DataCenter.getInstance();
		SNBaseLib.getInstance().init();
	}

	// 获取正在下载的应用数目
	public synchronized int getDownloadNum() {
		return dataCenter.listDownload.getSize();
	}

	public synchronized DownloadInfoList getDownloadList() {
		return dataCenter.listDownload;
	}

	public DownloadInfo getDownloadInfo(String strAppKey) {
		for (int i = 0; i < dataCenter.listDownload.getSize(); i++) {
			DownloadInfo info = (DownloadInfo) dataCenter.listDownload.getAt(i);
			if (info.strAppKey.equalsIgnoreCase(strAppKey) == true)
				return info;
		}

		return null;
	}

	public boolean isExistAppkeyInDownload(String strAppKey) {
		for (int i = 0; i < dataCenter.listDownload.getSize(); i++) {
			DownloadInfo info = (DownloadInfo) dataCenter.listDownload.getAt(i);
			if (info.strAppKey.equalsIgnoreCase(strAppKey) == true)
				return true;
		}

		return false;
	}
}
